<template>
  <button class="icon-button">
    <span class="icon">
      <slot name="icon">
        <svg-icon :type="icon" v-if="icon" />
      </slot>
    </span>
    <span class="text">
      <slot></slot>
    </span>
  </button>
</template>

<script setup lang="ts">
defineProps({
  icon: {
    type: String,
    default: '',
  },
})
</script>

<style scoped lang="scss">
.icon-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 12px;
  transition: all 0.3s ease;

  &:hover {
    transform: translateY(-2px);

    .icon {
      color: #ff4e50;
      transform: scale(1.1);
    }

    .text {
      color: #333;
      font-weight: 500;
    }
  }

  &:active {
    transform: translateY(0);

    .icon {
      transform: scale(0.95);
    }
  }

  .icon {
    font-size: 20px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    color: #666;
  }

  .text {
    font-size: 12px;
    color: #666;
    transition: all 0.2s ease;
  }
}
</style>
